Option Explicit

Private aList, aFilterList()
Private sAllElement$, sDelimiter$
Private iKeyColumnorRow%

Function List(arr)
    aList = arr
    ReDim aFilterList(1 To UBound(aList), 1 To UBound(aList, 2))
End Function

Function FilterElement(element, Optional delimiter = "|")
    sAllElement = element
    sDelimiter = delimiter
End Function


Function FilterColumnOrRowNumber(Optional kColumnorRow = 1)
    iKeyColumnorRow = kColumnorRow
End Function


Function FilterColumn()
    Dim aRow!
    Dim x%, y!
    aRow = 1
    For x = 1 To UBound(aList, 1)
        If aList(x, iKeyColumnorRow) = "" Then Exit For
        If sAllElement Like "*" & sDelimiter & aList(x, iKeyColumnorRow) & sDelimiter & "*" Then
            For y = 1 To UBound(aList, 2)
                aFilterList(aRow, y) = aList(x, y)
            Next y
            aRow = aRow + 1
        End If
    Next x
    FilterColumn = aFilterList
End Function


Function FilterRow()
    Dim aColumn!
    Dim x%, y!
    aColumn = 1
    For y = 1 To UBound(aList, 2)
        If aList(iKeyColumnorRow, y) = "" Then Exit For
        If sAllElement Like "*" & sDelimiter & aList(iKeyColumnorRow, y) & sDelimiter & "*" Then
            For x = 1 To UBound(aList, 1)
                aFilterList(x, aColumn) = aList(x, y)
            Next x
            aColumn = aColumn + 1
        End If
    Next y
    FilterRow = aFilterList
End Function

